package com.chuiyan.topnews.Adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.chuiyan.topnews.R;
import com.chuiyan.topnews.bean.TCollect;
import com.chuiyan.topnews.bean.THistory;
import com.chuiyan.topnews.bean.TLike;

import java.util.List;

public class LikeAdapter extends BaseAdapter {
    private List<TLike> mList;//数据源
    private LayoutInflater mInflater;//布局装载器对象
    private Context mContext;
    public LikeAdapter(Context context,List<TLike> list){
        super();
        this.mContext=context;
        this.mList=list;
    }
    @Override
    public int getCount() {
        return mList.size();
    }

    @Override
    public Object getItem(int position) {
        return mList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        mInflater = LayoutInflater.from(mContext);
        convertView = mInflater.inflate(R.layout.deepinfo,null);

        /**
         * 找到item布局文件中对应的控件
         */
        TextView titleTextView = (TextView) convertView.findViewById(R.id.content);

        //获取相应索引的ItemBean对象
        Object bean = mList.get(position);
        /**
         * 设置控件的对应属性值
         */
        titleTextView.setText(((TLike) bean).getlNTitle());
        return convertView;
    }
}
